export default {
  data() {
    return {
      pagelistLoading: true,
      dialogModelVisible: false,
      loading: false,
      list: [],
      total: 0,
      totalParams: {
        PageIndex: 1,
        PageSize: 50
      },
      tabStatus: {},
      fullRes: {},
      tabAwaitCount: null
    }
  },
  created() {
    if (this.httpUrl) this.httpGetListActions()
  },
  methods: {
    httpGetListActions() {
      this.pagelistLoading = true
      this.api[this.httpUrl]({
          ...this.queryParams,
          ...this.totalParams
        })
        .then(res => {
          if (this.responseName) {
            this.list = res
          } else {
            this.list = res.items
          }
          // 申请类型 未通过 条数
          this.tabAwaitCount = res.tabAwaitCount
          // 审核状态 条数
          this.tabStatus = res.tabStatus ? res.tabStatus : {}
          this.total = res.totalCount
          this.fullRes = res
        })
        .finally(() => {
          this.pagelistLoading = false
        })
    },
    searchHandle() {
      this.totalParams.PageIndex = 1
      this.httpGetListActions()
    },
    changecurrent(val) {
      this.totalParams.PageIndex = val
      this.httpGetListActions()
    },
    changePagination(PageSize) {
      this.totalParams.PageIndex = 1
      this.totalParams.PageSize = PageSize
      // console.log(this.totalParams)
      this.httpGetListActions()
    },
    resetQueryParams() {
      // this.setQueryParams({})
      this.httpGetListActions()
    },
    cancelFormAction() {
      this.dialogModelVisible = false
    }
  }
}